package org.emergency.framework.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.apache.log4j.Logger;
import org.emergency.framework.common.Context;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class EMContextLoaderListener extends ContextLoaderListener{
	private final Logger LOG = Logger.getLogger(this.getClass());
	
//	private SecurityManager securityManager;
	
	
//	@Resource(name = "securityManagerSupport")
//	public void setSecurityManager(SecurityManager securityManager) {
//		this.securityManager = securityManager;
//	}

	@Override
	public void contextDestroyed(ServletContextEvent event) {
		super.contextDestroyed(event);
	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		ServletContext servletContext = event.getServletContext();
		LOG.debug("Beginnig ContexLoaderListener......");
		Context.servletContext = servletContext;
		Context.webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
	}
	

}
